<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>编辑</title>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <!-- 引入JQuery  bootstrap.js-->
    <script src="/js/jquery-3.2.1.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>

<body>

<div id="content1">


<h5  id="title2">
    事故性质：
    <select>
    <c:forEach items="${accidentList}" var="accidents" >
        <option value="${accidents.accidentId}"
        <c:if test="${accidents.accidentId==plan.accidentId}">selected</c:if>>${accidents.accidentType}
        </option>
    </c:forEach>
</select>
    <a  id="put_link" href="javascript:">编辑</a>
    <a id="delete" href="javascript:">删除</a>
</h5>
  <%--  对象 ： ${plan.accidentId}--%>
灾害分析：
</div>

</body>
<script type="text/javascript">
    $(document).ready(function (){
        $("#delete").click(function (){
            if(confirm("确定要删除吗？")){
                $.ajax({
                    url: '/plan/'+${plan.id},
                    type: "delete",
                    success: function () {
                        alert("删除成功")
                        $(location).attr("href","/admin/showPlan")
                    },
                    error: function () {
                        alert("删除失败")
                    }

                })


            }


        });
        $("#put_link").click(function(){
            window.open ( "/plan/editPlan/${plan.id}");
        })
    });

</script>
</html>
